package com.cjm.algorithm.group.gupiao;

public class Ti122240602 {
    public int maxProfit(int[] prices) {
        int len = prices.length;
        if (len <2) return 0;
        int res = 0;
        for(int i = 1; i < len; i++){
            int diff = prices[i] - prices[i-1];
            if (diff > 0) {
                res+=diff;
            }
        }
        return res;
    }
}
